﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Data.OracleClient;

namespace Xiaov.SmartWeb.Application.HXZB
{
    public partial class SczbIndex : Xiaov.SmartWeb.Model.BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            PM_Filter_Statistical();
            if (!Page.IsPostBack)
            {
                BindDDL();
            }           
        }
      
        protected void BindDDL()
        {
            try
            {
                Statistics.UI.DDL.BindDDL(ddl_Owner, ddl_Year, ddl_Month, PUser.USERDEPT, true);
            }
            catch (Exception ex)
            {

            }
            //从cookies获取默认值
            if (Request.Cookies["UserSelectInfo"] != null)
            {
                ddl_Owner.SelectedValue = Request.Cookies["UserSelectInfo"]["DW"];
                ddl_Year.SelectedValue = Request.Cookies["UserSelectInfo"]["NF"];
                ddl_Month.SelectedValue = Request.Cookies["UserSelectInfo"]["YF"];
            }
            //if ((Session["yf"] != null) && (Session["nf"] != null))
            //{
            //    ddl_Month.SelectedValue = Session["yf"].ToString();
            //    ddl_Year.SelectedValue = Session["nf"].ToString();
            //}
        }

        protected void btnQuery_Click(object sender, EventArgs e)
        {
            //将年份、月份、单位、发送给客户端
            HttpCookie cookies = new HttpCookie("UserSelectInfo");
            cookies.Values["DW"] = ddl_Owner.SelectedValue;
            cookies.Values["NF"] = ddl_Year.SelectedValue;
            cookies.Values["YF"] = ddl_Month.SelectedValue;
            cookies.Expires = DateTime.MaxValue;
            HttpContext.Current.Response.Cookies.Add(cookies);
        }
    }
}